#!/usr/bin/env python

import sys
import pprint
import allconsuming.filedac

def main(args=None):
    if args == None:
        args = sys.argv[1:]


    allThings = {}
    allUsers = allconsuming.filedac.getUserList()

    for userName in [x[1] for x in allUsers]:
        consumables = allconsuming.filedac.getUserConsumables(userName)
        for c in consumables:
            allThings[c.itemNumber] = c.itemTitle

    stuff = []
    for (k, v) in allThings.items():
        stuff.append((v,k))

    stuff.sort()
    for (title, number) in stuff:
        print title, number

    return 0


if __name__ == '__main__':
    sys.exit(main())

